<!DOCTYPE html>
<html lang="en">

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
	
	<!-- title -->
	
	<title>
	
		01.安装Streamlit | 
	 
	Just Do It
	</title>
	
	<!-- keywords,description -->
	
		<meta name="keywords" content="编程" />
	 
		<meta name="description" content="盒饭" />
	

	<!-- favicon -->
	
	<link rel="shortcut icon" href="/learning-journey-blog/favicon.ico">
	


	<!-- search -->
	<script>
		var searchEngine = "https://www.google.com/search?q=";
		if(typeof searchEngine == "undefined" || searchEngine == null || searchEngine == ""){
			searchEngine = "https://www.google.com/search?q=";
		}
		var homeHost = "https://heefan.gitee.io/learning-journey-blog/";
		if(typeof homeHost == "undefined" || homeHost == null || homeHost == ""){
			homeHost = window.location.host;
		}
	</script>


	
<link rel="stylesheet" href="/learning-journey-blog/css/main.css">

	
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">

	
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.17.1/build/styles/darcula.min.css">

	
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">


	
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>

	
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>

	
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.17.1/build/highlight.min.js"></script>

	
<script src="https://cdn.jsdelivr.net/npm/jquery-pjax@2.0.1/jquery.pjax.min.js"></script>

	
<script src="/learning-journey-blog/js/main.js"></script>

	
		
<script src="https://cdn.jsdelivr.net/npm/leancloud-storage/dist/av-min.js"></script>

		
<script src="https://cdn.jsdelivr.net/npm/valine@v1.4.14/dist/Valine.min.js"></script>

	
	
		<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	
<meta name="generator" content="Hexo 6.3.0"></head>

<body>
	<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3efe99c287df5a1d6f0d02d187e403c1";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

<header id="header">
    <a id="title" href="/learning-journey-blog/" class="logo">Just Do It</a>

	<ul id="menu">
		<li class="menu-item">
			<a href="/learning-journey-blog/about" class="menu-item-link">ABOUT</a>
		</li>
	

	
	</ul>
</header>

	
<div id="sidebar">
	<button id="sidebar-toggle" class="toggle" ><i class="fa fa-arrow-right " aria-hidden="true"></i></button>
	
	<div id="site-toc">
		<input id="search-input" class="search-input" type="search" placeholder="按回车全站搜索">
		<div id="tree">
			

			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										Streamlit基础知识点
									</a>
									
							<ul>
								<li class="file">
									<a href="/learning-journey-blog/2023/01/26/Streamlit%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9/00-development-env/">
                     
										    00.工作环境
                     
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file active">
									<a href="/learning-journey-blog/2023/01/26/Streamlit%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9/01-install-streamlit/">
                     
										    01.安装Streamlit
                     
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/learning-journey-blog/2023/01/26/Streamlit%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9/02-ex-youtube-data-analysis/">
                     
										    02.项目-youtube数据分析
                     
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										一些思考
									</a>
									
							<ul>
								<li class="file">
									<a href="/learning-journey-blog/2023/01/27/%E4%B8%80%E4%BA%9B%E6%80%9D%E8%80%83/timeout-idempotence/">
                     
										    幂等性服务设计
                     
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										多用户博客系统
									</a>
									
							<ul>
								<li class="file">
									<a href="/learning-journey-blog/2023/01/26/%E5%A4%9A%E7%94%A8%E6%88%B7%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F/00-intro/">
                     
										    00.项目说明
                     
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/learning-journey-blog/2023/01/26/%E5%A4%9A%E7%94%A8%E6%88%B7%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F/00-project-technical-stack/">
                     
										    00.Blog项目技术栈
                     
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
		</div>
	</div>
</div>

	<!-- 引入正文 -->
	<div id="content">
		<h1 id="article-title">
	01.安装Streamlit
</h1>
<div class="article-meta">
	
	<span>Heefan</span>
	<span>2023-01-26 16:40:00</span>
		<div id="article-categories">
    
		<span>Categories：</span>
            
    
	<br>
    
		<span>Tags：</span>
            
                
                    <span>
                        <i class="fa fa-tag" aria-hidden="true">
                        <a href="/tags/streamlit-basic/">streamlit-basic</a>
                        </i>
                    </span>
                
            
    
		</div>

</div>

<div id="article-content">
	<h2 id="本文目标">本文目标</h2>
<p>初次接触Streamlit，按照<a target="_blank" rel="noopener" href="https://30days.streamlit.app/">30 Days of Streamlit</a>安装一下环境。<br>
主要安装<code>streamlit</code>，并且运行一个例子。</p>
<blockquote>
<p>注意：<br>
我使用<code>pyenv</code>来管理我的python版本及其依赖。官方教程使用conda。我不使用conda。</p>
</blockquote>
<h2 id="要掌握的知识点">要掌握的知识点</h2>
<h3 id="三个命令">三个命令</h3>
<pre><code class="language-bash">❯ pip install streamlit
❯ pip install watchdog
❯ streamlit hello
</code></pre>
<p>默认浏览器会自动启动<code>http://localhost:8501/</code><br>
<img src="https://30days.streamlit.app/~/+/media/3876bb40e352fe047681d015501a728a9e398892a38089635ebe0799.png" alt=""></p>
<hr>
<h3 id="吐槽-TD-DR">吐槽 TD;DR</h3>
<h4 id="1-为什么不用python3-9">1.为什么不用<code>python3.9</code></h4>
<p>因为<code>$pyenv install 3.9</code>出现错误</p>
<pre><code class="language-bash">ginstall: cannot create directory ‘/Library/Frameworks/Python.framework’: Permission denied
</code></pre>
<blockquote>
<p>原则：不折腾</p>
</blockquote>
<p>3.9不是我的强需求，3.10也可以使用。</p>
<p>思路：对于<code>Permission denied</code>问题，使用<code>sudo chown $USER [Path]</code> 通常可以解决问题。也可以使用conda安装python3.9</p>
<h4 id="2-使用Conda">2. 使用Conda</h4>
<p><a target="_blank" rel="noopener" href="https://docs.conda.io/en/latest/miniconda.html#macos-installers">Miniconda3 macOS Apple M1 ARM 64-bit pkg</a><br>
默认安装在<code>$HOME/opt/anaconda3/</code></p>
<p>使用conda创建python3.9开发环境<code>stenv</code></p>
<pre><code class="language-bash">conda create -n stenv python=3.9
</code></pre>
<p>默认安装到目录： <code>$HOME/miniconda3/envs/stenv</code></p>
<pre><code class="language-bash">$source ~/.zshrc
$conda activate stenv
❯ which python3.9
$HOME/miniconda3/envs/stenv/bin/python3.9
</code></pre>
<hr>

</div>


    <div class="post-guide">
        <div class="item left">
            
              <a href="/learning-journey-blog/2023/01/26/Streamlit%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9/02-ex-youtube-data-analysis/">
                  <i class="fa fa-angle-left" aria-hidden="true"></i>
                  02.项目-youtube数据分析
              </a>
            
        </div>
        <div class="item right">
            
              <a href="/learning-journey-blog/2023/01/26/Streamlit%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9/00-development-env/">
                00.工作环境
                <i class="fa fa-angle-right" aria-hidden="true"></i>
              </a>
            
        </div>
    </div>




<script>
	
	
</script>
	</div>
	<div id="footer">
	<p>
	©2023-<span id="footerYear"></span> 
	<a href="/">Heefan</a> 
	
	
		|
		<span id="busuanzi_container_site_pv">
			pv
			<span id="busuanzi_value_site_pv"></span>
		</span>
		|
		<span id="busuanzi_container_site_uv"> 
			uv
			<span id="busuanzi_value_site_uv"></span>
		</span>
	
	<br>
	Theme <a href="//github.com/wujun234/hexo-theme-tree" target="_blank">Tree</a>
	by <a href="//github.com/wujun234" target="_blank">WuJun</a>
	Powered by <a href="//hexo.io" target="_blank">Hexo</a>
	</p>
</div>
<script type="text/javascript"> 
	document.getElementById('footerYear').innerHTML = new Date().getFullYear() + '';
</script>
	<button id="totop-toggle" class="toggle"><i class="fa fa-angle-double-up" aria-hidden="true"></i></button>
</body>
</html>